#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
int main()
{
  extern char **environ; 
  pid_t id=fork();
  if(id==0)
  {
    //child 
    printf("我是子进程：%d\n",getpid());
  // execl("/bin/lsssss","lssssss","-a","-l",NULL);
   //printf("you can see me %d",n);
   //char *const myargv[]={"ls","-a","-l","-n",NULL};
   // exit(0);
   // execv("/bin/ls",myargv);
    //execlp("ls","ls","-a","-l","-n",NULL);
  //bin//  char*const myenv[]={
   //   "MYENV=YouCanSeeMe",
  //    NULL
  //bin  };
  putenv("MYENV=YouCanSeeMe");
   execle("./exec/otherproc","otherproc",NULL,environ);
    exit(1);
  }

  sleep(5);
  //father
  int status=0;
  printf("我是父进程:%d\n",getpid());
  waitpid(id,&status,0);
  printf("child exit code:%d\n",WEXITSTATUS(status));
  return 0;
}
